// ---------------------   左中task7 折线面积图  --------------------------------------
function market2(market_name = '华冠超市') {
    $.post('http://127.0.0.1:5000/data-api/task2', {market_name: market_name}).done(function (data) {
        var myChart = echarts.init(document.querySelector(".leftMid .chart"));
        var option = {
            tooltip: {
                trigger: 'item',
                axisPointer: {  type: 'shadow'    }
                          },                
            animationDurationUpdate: 1500,
            animationEasingUpdate: 'quinticInOut',
            series: [
                {
                    type: 'graph',
                    layout: 'none',
                    symbolSize: 50,
                    roam: true,
                    edgeSymbol: ['circle', 'arrow'],
                    edgeSymbolSize: [4, 10],
                    edgeLabel: {
                        fontSize: 20
                    },
                    data: data['data'],
                    links: data['links'],
                    label: {
                        show: true,
                        color: '#4f4f4f',
                        fontSize: 12,
                    },
                    itemStyle: {
                        color: function (param) {
                            var colorList = ['#6bc0fb', '#b0a0d4', '#fedd8b', '#92dcd7', '#E88AF2',
                                            '#b8edff', '#ffb5a6', '#ff8d8d', '#2581d7', '#F0B85C'];
                            var i = param.dataIndex;
                            if (param.dataIndex > 8) {
                                i = i-9;
                            }
                            return colorList[i]
                        },
                    },
                    lineStyle: {
                        opacity: 0.9,
                        width: 2,
                        color: 'source',
                        curveness: 0.3
                    },
                    emphasis: {
                        focus: 'adjacency',
                        lineStyle: {
                            width: 10
                        }
                    }
                }
            ]
        };
        myChart.setOption(option);
        window.addEventListener("resize", function () {
            myChart.resize();
        });
    });
}

// 启动|刷新 浏览器 调用
market2();